Stub Article
This article needs more information, clarification, or completion.
You can help us by expanding this article. There may be more information on its talk page.


Bignums, rationals, complex #s is a library in Snap! that significantly increases the maximum amount of number digits to what the memory can hold. It also adds support for exact fractions and complex numbers. It allows for infinite precision, exact rational, and complex numbers. Infinite precision numbers are only limited by the memory of your computer. Exact rational numbers store numbers as a fraction, so 4/5 is represented exactly as 4 5th's, instead of a collection of digits. Complex numbers allow for the use of imaginary and complex numbers in all operations.

Bignums can be turned on with the USE BIGNUMS <> :: operators block.


As a library, Bignums is incompatible with some existing blocks, especially if using exact rational or complex numbers. One common fix is to use (Scheme number [inexact v] of [] :: operators) when using them, but that will cause a loss of precision.

A tutorial is available.

Blocks

USE BIGNUMS <>::operators
(()!::operators)
([]::operators)
(Scheme number [ v] of []::operators)